//
// Created by v on 18-9-12.
//

#ifndef SRC_CM_BROADCAST_H
#define SRC_CM_BROADCAST_H

#include <unistd.h>

#ifdef __cplusplus
extern "C"
{
#endif

    typedef struct CMBroadcast *CMBroadcastHandle;

    int cm_broadcast_set_info(CMBroadcastHandle h, const char *mac,
                              const char *ip, const char *version);

    int cm_broadcast_init(CMBroadcastHandle *h, int port);

    int cm_broadcast_socket_init_simple(CMBroadcastHandle h);

    int cm_broadcast_bind(CMBroadcastHandle h);

    int cm_broadcast_start(CMBroadcastHandle h);

    int cm_broadcast_close(CMBroadcastHandle *h);

    int cm_broadcast_send(CMBroadcastHandle h, char *data, size_t len);
    int cm_broadcast_recv(CMBroadcastHandle h, char *data, size_t len);

#ifdef __cplusplus
};
#endif

#endif // SRC_CM_BROADCAST_H
